package com.lordjoe.collectiveintelligence.data;

import java.util.*;

/**
 * com.lordjoe.collectiveintelligence.data.WeightedDataSet
 *
 * @author Steve Lewis
 * @date May 12, 2009
 */
public class WeightedDataSet
{
    public static WeightedDataSet[] EMPTY_ARRAY = {};
    public static Class THIS_CLASS = WeightedDataSet.class;

    private final IDataSet m_Data;
    private final Map<IMeasurementType,IDistribution> m_TypeToDistribution =
            new HashMap<IMeasurementType,IDistribution>();
    private final Map<IDataItem,Map<IDataItem,Double>> m_Distances =
            new HashMap<IDataItem,Map<IDataItem,Double>>();

    public WeightedDataSet(IDataSet pData)
    {
        m_Data = pData;
        buildDistributions();
        buildDistances();
    }

    protected void buildDistances()
    {
        IDataSet data = getData();
        IDataItem[] items = data.getItems();
        for (int i = 0; i < items.length; i++) {
            IDataItem i1 = items[i];
            for (int j = i + 1; j < items.length; j++) {
                IDataItem i2 = items[j];
                
            }
        }

    }
    protected void buildDistributions()
    {
        IDataSet data = getData();
        IMeasurementType[] types = data.getTypes();
        for (int i = 0; i < types.length; i++) {
            IMeasurementType type = types[i];
            IMeasurementSet measurements = data.getMeasurements(type);
            MeasurementSetDistribution distribution = new MeasurementSetDistribution(type,
                    measurements);
            m_TypeToDistribution.put(type,distribution);
        }
    }

    public IDataSet getData()
    {
        return m_Data;
    }


}
